using System.Collections.Generic;

namespace SolarWinds.Widgets
{
    internal class TabOrderComparer : IComparer<Widget>
    {
        // Fields
        public static readonly TabOrderComparer Default = new TabOrderComparer();

        // Methods
        public int Compare(Widget x, Widget y)
        {
            if ((x == null) && (y == null))
            {
                return 0;
            }
            if (x != null)
            {
                if (y == null)
                {
                    return -1;
                }
                if (x.Equals(y))
                {
                    return 0;
                }
                if (x.TabOrder < y.TabOrder)
                {
                    return -1;
                }
            }
            return 1;
        }
    }
}